<?php 
$attributes = array('id' => 'add_form_ind');
echo form_open('indicator/saveindicator/' . $idBusinessLine . '/' . $idOutcome . '/' . $idOutput, $attributes); ?>
<table width="100%">
	<tr>
    	<td class="menuActual">Config > Data > Add Indicator</td>
    </tr>
    <tr>
    	<td>
        	<span id='ind_form_msg' class="msg_error">* Required fields</span>
            <table>
			<?php
            if(!isset($indicator)) $indicator = new Indicator_dto();
            echo form_hidden('idInd', $indicator->id);
            ?>
            
              <tr>
                <td class="descripcionForm"><?php	echo form_label("Name: *");?></td>
                <td class="descripcionForm">
                    <?php
                    $attributes = array('id' => 'nameInd', 'rows' => '3', 'cols' => '50','name' => 'nameInd', 'maxlength' => '250', 
                    'value' => (set_value('nameInd') == '' ? $indicator->name : set_value('nameInd')));
                    echo form_textarea($attributes);
                    ?>
                </td>
              </tr>
              
              <tr>
                <td class="descripcionForm"><?php echo form_label("Output: *"); ?></td>
                <td class="descripcionForm">
                    <?php
					$opcionesOP = array();
                    if(isset($outputs)){
						$defaultSelection = $indicator->idOutput;
						foreach ($outputs as $output) {
							$nombreOP_cortado = strlen($output->name) > 50 ? substr($output->name, 0, 50) . ' (...)' : $output->name;
                            $opcionesOP[$output->id] = $nombreOP_cortado;
							if($defaultSelection == 0) $defaultSelection = $output->id;
						}
					
						echo form_dropdown('output_ind', $opcionesOP, $defaultSelection, 'id=output_ind');
					}
                    ?>
                </td>
              </tr>
              
              <tr>
                    <td class="descripcionForm" colspan="2"><?php echo validation_errors(); ?></td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<?php echo form_close();?>